<?php

/**
 * CompraEspecial form base class.
 *
 * @method CompraEspecial getObject() Returns the current form's model object
 *
 * @package    dirsac
 * @subpackage form
 * @author     Miguel Flores
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseCompraEspecialForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'               => new sfWidgetFormInputHidden(),
      'cuenta_id'        => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Cuenta'), 'add_empty' => false)),
      'nombre_encargado' => new sfWidgetFormInputText(),
      'correo_encargado' => new sfWidgetFormInputText(),
      'anexo_encargado'  => new sfWidgetFormInputText(),
      'cotizacion'       => new sfWidgetFormInputText(),
      'neto'             => new sfWidgetFormInputText(),
      'iva'              => new sfWidgetFormInputText(),
      'total'            => new sfWidgetFormInputText(),
      'estado'           => new sfWidgetFormInputText(),
      'plazo_entrega'    => new sfWidgetFormDate(),
      'created_at'       => new sfWidgetFormDateTime(),
      'updated_at'       => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'               => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'cuenta_id'        => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Cuenta'))),
      'nombre_encargado' => new sfValidatorString(array('max_length' => 255)),
      'correo_encargado' => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'anexo_encargado'  => new sfValidatorInteger(),
      'cotizacion'       => new sfValidatorString(array('max_length' => 255)),
      'neto'             => new sfValidatorInteger(),
      'iva'              => new sfValidatorInteger(),
      'total'            => new sfValidatorInteger(),
      'estado'           => new sfValidatorString(array('max_length' => 30, 'required' => false)),
      'plazo_entrega'    => new sfValidatorDate(array('required' => false)),
      'created_at'       => new sfValidatorDateTime(),
      'updated_at'       => new sfValidatorDateTime(),
    ));

    $this->widgetSchema->setNameFormat('compra_especial[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'CompraEspecial';
  }

}
